﻿using Microsoft.Xna.Framework.Graphics;

namespace RunGun
{
    /// <summary>
    /// Concrete sealed class that contains the model, texture and shader effect for an 3d object
    /// </summary>
    public sealed class GameModel : GameModelBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="GameModel"/> class.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="texture">The texture.</param>
        /// <param name="shaderEffect">The shader effect.</param>
        public GameModel(Model model, Texture2D texture, IShaderEffect shaderEffect) : base(model, texture, shaderEffect)
        {
        }

        /// <summary>
        /// Draws the model.
        /// </summary>
        /// <param name="camera">The game camera.</param>
        public override void Draw(CameraBase camera)
        {
            foreach (var mesh in Model.Meshes)
            {
                ShaderEffect.ApplyEffect(mesh, camera);
                mesh.Draw();
            }
        }
    }
}